package demo01extends;

import java.util.ArrayList;

/*
* 自定义方法，打印集合，格式：
* {。。。@。。。@。。@。。}
* */
public class Demo06ArrayListPrint<psvm> {
    public static void main(String[] args) {
        ArrayList<String> list=new ArrayList<>();
        list.add("zhang");
        list.add("wang");
        list.add("li");
        ArrayListprint(list);
    }
    public static void ArrayListprint(ArrayList<String> list){
        System.out.print("{");
        for (int i = 0; i < list.size(); i++) {
            String name=list.get(i);
            if(i<list.size()-1){
                System.out.print(name+"@");
            }
            else {
                System.out.print(name + "}");

            }
        }
    }
}
